package io.awen.modules.sign.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.awen.common.exception.RRException;
import io.awen.modules.sign.dao.SignContainerAlarmDao;
import io.awen.modules.sign.dao.SignContainerRealtimeLiquidLevelDao;
import io.awen.modules.sign.entity.SignContainerAlarmEntity;
import io.awen.modules.sign.entity.SignContainerRealtimeLiquidLevelEntity;
import io.awen.modules.sign.service.SignContainerRealtimeLiquidLevelService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 容器信息表(SignContainerRealtimeLiquidLevel)表服务实现类
 *
 * @author makejava
 * @since 2022-11-18 16:34:44
 */
@Service("signContainerRealtimeLiquidLevelService")
public class SignContainerRealtimeLiquidLevelServiceImpl extends ServiceImpl<SignContainerRealtimeLiquidLevelDao, SignContainerRealtimeLiquidLevelEntity> implements SignContainerRealtimeLiquidLevelService {
    @Resource
    private SignContainerRealtimeLiquidLevelDao signContainerRealtimeLiquidLevelDao;

    @Override
    public void insert(SignContainerRealtimeLiquidLevelEntity entity) {
        entity.setCreateTime(new Date());
        save(entity);
    }

    @Override
    public List<SignContainerRealtimeLiquidLevelEntity> getAllByDate(String containerId, String startDatetime, String endDatetime) {
        if(StringUtils.isBlank(containerId)){
            throw new RRException("containerId不能为空");
        }
        return signContainerRealtimeLiquidLevelDao.getAllByDate(containerId,startDatetime,endDatetime);
    }
}
